/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

@media (forced-colors: active) {
    :host {
        --highcontrast-table-row-background-color: Canvas;
        --highcontrast-table-row-text-color: CanvasText;
        --highcontrast-table-divider-color: CanvasText;
        --highcontrast-table-border-color: CanvasText;
        --highcontrast-table-icon-color: CanvasText;
        --highcontrast-table-icon-color-focus: Highlight;
        --highcontrast-table-selected-row-background-color: Highlight;
        --highcontrast-table-selected-row-text-color: HighlightText;
        --highcontrast-table-selected-row-background-color-focus: Highlight;
        --highcontrast-table-selected-row-text-color-focus: HighlightText;
        --highcontrast-table-row-background-color-hover: Highlight;
        --highcontrast-table-row-text-color-hover: HighlightText;
        --highcontrast-table-section-header-text-color: Canvas;
        --highcontrast-table-section-header-background-color: CanvasText;
        --highcontrast-table-focus-indicator-color: Highlight;
        --highcontrast-table-transition-duration: 0;
    }

    @supports (color: SelectedItem) {
        :host {
            --highcontrast-table-selected-row-background-color: SelectedItem;
            --highcontrast-table-selected-row-text-color: SelectedItemText;
        }
    }
}

:host {
    --spectrum-table-cell-inline-space: var(--spectrum-table-edge-to-content);
    --spectrum-table-border-radius: var(--spectrum-corner-radius-100);
    --spectrum-table-border-width: var(--spectrum-table-border-divider-width);
    --spectrum-table-outer-border-inline-width: var(--spectrum-table-border-divider-width);
    --spectrum-table-default-vertical-align: top;
    --spectrum-table-header-vertical-align: middle;
    --spectrum-table-header-font-weight: var(--spectrum-bold-font-weight);
    --spectrum-table-row-font-family: var(--spectrum-sans-font-family-stack);
    --spectrum-table-row-font-weight: var(--spectrum-regular-font-weight);
    --spectrum-table-row-font-style: var(--spectrum-default-font-style);
    --spectrum-table-row-line-height: var(--spectrum-line-height-100);
    --spectrum-table-border-color: var(--spectrum-gray-300);
    --spectrum-table-divider-color: var(--spectrum-gray-300);
    --spectrum-table-header-background-color: var(--spectrum-transparent-white-100);
    --spectrum-table-header-text-color: var(--spectrum-body-color);
    --spectrum-table-row-background-color: var(--spectrum-gray-50);
    --spectrum-table-row-text-color: var(--spectrum-neutral-content-color-default);
    --spectrum-table-selected-row-background-color: rgba(var(--spectrum-blue-900-rgb), var(--spectrum-table-selected-row-background-opacity));
    --spectrum-table-selected-row-background-color-non-emphasized: rgba(var(--spectrum-gray-700-rgb), var(--spectrum-table-selected-row-background-opacity-non-emphasized));
    --spectrum-table-row-background-color-hover: rgba(var(--spectrum-gray-900-rgb), var(--spectrum-table-row-hover-opacity));
    --spectrum-table-row-active-color: rgba(var(--spectrum-gray-900-rgb), var(--spectrum-table-row-down-opacity));
    --spectrum-table-selected-row-background-color-focus: rgba(var(--spectrum-blue-900-rgb), var(--spectrum-table-selected-row-background-opacity-hover));
    --spectrum-table-selected-row-background-color-non-emphasized-focus: rgba(var(--spectrum-gray-700-rgb), var(--spectrum-table-selected-row-background-opacity-non-emphasized-hover));
    --spectrum-table-icon-color-default: var(--spectrum-neutral-subdued-content-color-default);
    --spectrum-table-icon-color-hover: var(--spectrum-neutral-subdued-content-color-hover);
    --spectrum-table-icon-color-active: var(--spectrum-neutral-subdued-content-color-down);
    --spectrum-table-icon-color-focus: var(--spectrum-neutral-subdued-content-color-key-focus);
    --spectrum-table-icon-color-focus-hover: var(--spectrum-neutral-subdued-content-color-key-focus);
    --spectrum-table-icon-color-key-focus: var(--spectrum-neutral-subdued-content-color-key-focus);
    --spectrum-table-focus-indicator-thickness: var(--spectrum-focus-indicator-thickness);
    --spectrum-table-focus-indicator-color: var(--spectrum-focus-indicator-color);
    --spectrum-table-drop-zone-background-color: rgba(var(--spectrum-drop-zone-background-color-rgb), var(--spectrum-drop-zone-background-color-opacity));
    --spectrum-table-drop-zone-outline-color: var(--spectrum-accent-visual-color);
    --spectrum-table-transition-duration: var(--spectrum-animation-duration-100);
    --spectrum-table-summary-row-font-weight: var(--spectrum-bold-font-weight);
    --spectrum-table-summary-row-background-color: var(--spectrum-gray-200);
    --spectrum-table-section-header-font-weight: var(--spectrum-bold-font-weight);
    --spectrum-table-section-header-background-color: var(--spectrum-gray-200);
    --spectrum-table-collapsible-tier-indent: var(--spectrum-spacing-300);
    --spectrum-table-collapsible-disclosure-inline-spacing: 0px;
    --spectrum-table-collapsible-icon-animation-duration: var(--spectrum-animation-duration-100);
    --spectrum-table-cell-background-color: var(--highcontrast-table-row-background-color, var(--mod-table-row-background-color, var(--spectrum-table-row-background-color)));
    --spectrum-table-selected-cell-background-color: var(--highcontrast-table-selected-row-background-color, var(--mod-table-selected-row-background-color-non-emphasized, var(--spectrum-table-selected-row-background-color-non-emphasized)));
    --spectrum-table-selected-cell-background-color-focus: var(--highcontrast-table-selected-row-background-color-focus, var(--mod-table-selected-row-background-color-non-emphasized-focus, var(--spectrum-table-selected-row-background-color-non-emphasized-focus)));
    --mod-thumbnail-size: var(--mod-table-thumbnail-size, var(--spectrum-table-thumbnail-size));
}

:host:dir(rtl),
:host([dir="rtl"]) {
    --spectrum-logical-rotation: matrix(-1, 0, 0, 1, 0, 0);
}

:host,
.spectrum-Table--sizeM {
    --spectrum-table-min-header-height: var(--spectrum-component-height-100);
    --spectrum-table-header-top-to-text: var(--spectrum-table-column-header-row-top-to-text-medium);
    --spectrum-table-header-bottom-to-text: var(--spectrum-table-column-header-row-bottom-to-text-medium);
    --spectrum-table-min-row-height: var(--spectrum-table-row-height-medium-regular);
    --spectrum-table-row-top-to-text: var(--spectrum-table-row-top-to-text-medium-regular);
    --spectrum-table-row-bottom-to-text: var(--spectrum-table-row-bottom-to-text-medium-regular);
    --spectrum-table-icon-to-text: var(--spectrum-text-to-visual-100);
    --spectrum-table-row-font-size: var(--spectrum-font-size-100);
    --spectrum-table-header-checkbox-block-spacing: var(--spectrum-table-header-row-checkbox-to-top-medium);
    --spectrum-table-row-checkbox-block-spacing: var(--spectrum-table-row-checkbox-to-top-medium-regular);
    --spectrum-table-section-header-min-height: var(--spectrum-table-section-header-row-height-medium);
    --spectrum-table-section-header-block-start-spacing: var(--spectrum-component-top-to-text-100);
    --spectrum-table-section-header-block-end-spacing: var(--spectrum-component-bottom-to-text-100);
    --spectrum-table-disclosure-icon-size: var(--spectrum-component-height-100);
    --spectrum-table-thumbnail-block-spacing: var(--spectrum-table-thumbnail-to-top-minimum-medium-regular);
    --spectrum-table-thumbnail-to-text: var(--spectrum-text-to-visual-100);
    --spectrum-table-thumbnail-size: var(--spectrum-thumbnail-size-300);
}

:host([size="s"]) {
    --spectrum-table-min-header-height: var(--spectrum-component-height-100);
    --spectrum-table-header-top-to-text: var(--spectrum-table-column-header-row-top-to-text-small);
    --spectrum-table-header-bottom-to-text: var(--spectrum-table-column-header-row-bottom-to-text-small);
    --spectrum-table-min-row-height: var(--spectrum-table-row-height-small-regular);
    --spectrum-table-row-top-to-text: var(--spectrum-table-row-top-to-text-small-regular);
    --spectrum-table-row-bottom-to-text: var(--spectrum-table-row-bottom-to-text-small-regular);
    --spectrum-table-icon-to-text: var(--spectrum-text-to-visual-100);
    --spectrum-table-row-font-size: var(--spectrum-font-size-75);
    --spectrum-table-header-checkbox-block-spacing: var(--spectrum-table-header-row-checkbox-to-top-small);
    --spectrum-table-row-checkbox-block-spacing: var(--spectrum-table-row-checkbox-to-top-small-regular);
    --spectrum-table-section-header-min-height: var(--spectrum-table-section-header-row-height-small);
    --spectrum-table-section-header-block-start-spacing: var(--spectrum-component-top-to-text-75);
    --spectrum-table-section-header-block-end-spacing: var(--spectrum-component-bottom-to-text-75);
    --spectrum-table-disclosure-icon-size: var(--spectrum-component-height-75);
    --spectrum-table-thumbnail-block-spacing: var(--spectrum-table-thumbnail-to-top-minimum-small-regular);
    --spectrum-table-thumbnail-to-text: var(--spectrum-text-to-visual-100);
    --spectrum-table-thumbnail-size: var(--spectrum-thumbnail-size-200);
}

:host([size="l"]) {
    --spectrum-table-min-header-height: var(--spectrum-component-height-200);
    --spectrum-table-header-top-to-text: var(--spectrum-table-column-header-row-top-to-text-large);
    --spectrum-table-header-bottom-to-text: var(--spectrum-table-column-header-row-bottom-to-text-large);
    --spectrum-table-min-row-height: var(--spectrum-table-row-height-large-regular);
    --spectrum-table-row-top-to-text: var(--spectrum-table-row-top-to-text-large-regular);
    --spectrum-table-row-bottom-to-text: var(--spectrum-table-row-bottom-to-text-large-regular);
    --spectrum-table-icon-to-text: var(--spectrum-text-to-visual-200);
    --spectrum-table-row-font-size: var(--spectrum-font-size-200);
    --spectrum-table-header-checkbox-block-spacing: var(--spectrum-table-header-row-checkbox-to-top-large);
    --spectrum-table-row-checkbox-block-spacing: var(--spectrum-table-row-checkbox-to-top-large-regular);
    --spectrum-table-section-header-min-height: var(--spectrum-table-section-header-row-height-large);
    --spectrum-table-section-header-block-start-spacing: var(--spectrum-component-top-to-text-200);
    --spectrum-table-section-header-block-end-spacing: var(--spectrum-component-bottom-to-text-200);
    --spectrum-table-disclosure-icon-size: var(--spectrum-component-height-200);
    --spectrum-table-thumbnail-block-spacing: var(--spectrum-table-thumbnail-to-top-minimum-large-regular);
    --spectrum-table-thumbnail-to-text: var(--spectrum-text-to-visual-200);
    --spectrum-table-thumbnail-size: var(--spectrum-thumbnail-size-500);
}

:host([size="xl"]) {
    --spectrum-table-min-header-height: var(--spectrum-component-height-300);
    --spectrum-table-header-top-to-text: var(--spectrum-table-column-header-row-top-to-text-extra-large);
    --spectrum-table-header-bottom-to-text: var(--spectrum-table-column-header-row-bottom-to-text-extra-large);
    --spectrum-table-min-row-height: var(--spectrum-table-row-height-extra-large-regular);
    --spectrum-table-row-top-to-text: var(--spectrum-table-row-top-to-text-extra-large-regular);
    --spectrum-table-row-bottom-to-text: var(--spectrum-table-row-bottom-to-text-extra-large-regular);
    --spectrum-table-icon-to-text: var(--spectrum-text-to-visual-300);
    --spectrum-table-row-font-size: var(--spectrum-font-size-300);
    --spectrum-table-header-checkbox-block-spacing: var(--spectrum-table-header-row-checkbox-to-top-extra-large);
    --spectrum-table-row-checkbox-block-spacing: var(--spectrum-table-row-checkbox-to-top-extra-large-regular);
    --spectrum-table-section-header-min-height: var(--spectrum-table-section-header-row-height-extra-large);
    --spectrum-table-section-header-block-start-spacing: var(--spectrum-component-top-to-text-300);
    --spectrum-table-section-header-block-end-spacing: var(--spectrum-component-bottom-to-text-300);
    --spectrum-table-disclosure-icon-size: var(--spectrum-component-height-300);
    --spectrum-table-thumbnail-block-spacing: var(--spectrum-table-thumbnail-to-top-minimum-extra-large-regular);
    --spectrum-table-thumbnail-to-text: var(--spectrum-text-to-visual-300);
    --spectrum-table-thumbnail-size: var(--spectrum-thumbnail-size-700);
}

:host([density="compact"]) {
    --mod-table-min-row-height: var(--mod-table-min-row-height--compact, var(--spectrum-table-row-height-medium-compact));
    --mod-table-row-top-to-text: var(--mod-table-row-top-to-text--compact, var(--spectrum-table-row-top-to-text-medium-compact));
    --mod-table-row-bottom-to-text: var(--mod-table-row-bottom-to-text--compact, var(--spectrum-table-row-bottom-to-text-medium-compact));
    --mod-table-row-checkbox-block-spacing: var(--mod-table-row-checkbox-block-spacing--compact, var(--spectrum-table-row-checkbox-to-top-medium-compact));
    --mod-table-thumbnail-block-spacing: var(--mod-table-thumbnail-block-spacing-compact, var(--spectrum-table-thumbnail-to-top-minimum-medium-compact));
    --mod-table-thumbnail-size: var(--mod-table-thumbnail-size-compact, var(--spectrum-thumbnail-size-200));
}

:host([density="compact"][size="s"]) {
    --mod-table-min-row-height: var(--mod-table-min-row-height--compact, var(--spectrum-table-row-height-small-compact));
    --mod-table-row-top-to-text: var(--mod-table-row-top-to-text--compact, var(--spectrum-table-row-top-to-text-small-compact));
    --mod-table-row-bottom-to-text: var(--mod-table-row-bottom-to-text--compact, var(--spectrum-table-row-bottom-to-text-small-compact));
    --mod-table-row-checkbox-block-spacing: var(--mod-table-row-checkbox-block-spacing--compact, var(--spectrum-table-row-checkbox-to-top-small-compact));
    --mod-table-thumbnail-block-spacing: var(--mod-table-thumbnail-block-spacing-compact, var(--spectrum-table-thumbnail-to-top-minimum-small-compact));
    --mod-table-thumbnail-size: var(--mod-table-thumbnail-size-compact, var(--spectrum-thumbnail-size-50));
}

:host([density="compact"][size="l"]) {
    --mod-table-min-row-height: var(--mod-table-min-row-height--compact, var(--spectrum-table-row-height-large-compact));
    --mod-table-row-top-to-text: var(--mod-table-row-top-to-text--compact, var(--spectrum-table-row-top-to-text-large-compact));
    --mod-table-row-bottom-to-text: var(--mod-table-row-bottom-to-text--compact, var(--spectrum-table-row-bottom-to-text-large-compact));
    --mod-table-row-checkbox-block-spacing: var(--mod-table-row-checkbox-block-spacing--compact, var(--spectrum-table-row-checkbox-to-top-large-compact));
    --mod-table-thumbnail-block-spacing: var(--mod-table-thumbnail-block-spacing-compact, var(--spectrum-table-thumbnail-to-top-minimum-large-compact));
    --mod-table-thumbnail-size: var(--mod-table-thumbnail-size-compact, var(--spectrum-thumbnail-size-300));
}

:host([density="compact"][size="xl"]) {
    --mod-table-min-row-height: var(--mod-table-min-row-height--compact, var(--spectrum-table-row-height-extra-large-compact));
    --mod-table-row-top-to-text: var(--mod-table-row-top-to-text--compact, var(--spectrum-table-row-top-to-text-extra-large-compact));
    --mod-table-row-bottom-to-text: var(--mod-table-row-bottom-to-text--compact, var(--spectrum-table-row-bottom-to-text-extra-large-compact));
    --mod-table-row-checkbox-block-spacing: var(--mod-table-row-checkbox-block-spacing--compact, var(--spectrum-table-row-checkbox-to-top-extra-large-compact));
    --mod-table-thumbnail-block-spacing: var(--mod-table-thumbnail-block-spacing-compact, var(--spectrum-table-thumbnail-to-top-minimum-extra-large-compact));
    --mod-table-thumbnail-size: var(--mod-table-thumbnail-size-compact, var(--spectrum-thumbnail-size-500));
}

:host([density="spacious"]) {
    --mod-table-min-row-height: var(--mod-table-min-row-height--spacious, var(--spectrum-table-row-height-medium-spacious));
    --mod-table-row-top-to-text: var(--mod-table-row-top-to-text--spacious, var(--spectrum-table-row-top-to-text-medium-spacious));
    --mod-table-row-bottom-to-text: var(--mod-table-row-bottom-to-text--spacious, var(--spectrum-table-row-bottom-to-text-medium-spacious));
    --mod-table-row-checkbox-block-spacing: var(--mod-table-row-checkbox-block-spacing--spacious, var(--spectrum-table-row-checkbox-to-top-medium-spacious));
    --mod-table-thumbnail-block-spacing: var(--mod-table-thumbnail-block-spacing-spacious, var(--spectrum-table-thumbnail-to-top-minimum-medium-spacious));
    --mod-table-thumbnail-size: var(--mod-table-thumbnail-size-spacious, var(--spectrum-thumbnail-size-500));
}

:host([density="spacious"][size="s"]) {
    --mod-table-min-row-height: var(--mod-table-min-row-height--spacious, var(--spectrum-table-row-height-small-spacious));
    --mod-table-row-top-to-text: var(--mod-table-row-top-to-text--spacious, var(--spectrum-table-row-top-to-text-small-spacious));
    --mod-table-row-bottom-to-text: var(--mod-table-row-bottom-to-text--spacious, var(--spectrum-table-row-bottom-to-text-small-spacious));
    --mod-table-row-checkbox-block-spacing: var(--mod-table-row-checkbox-block-spacing--spacious, var(--spectrum-table-row-checkbox-to-top-small-spacious));
    --mod-table-thumbnail-block-spacing: var(--mod-table-thumbnail-block-spacing-spacious, var(--spectrum-table-thumbnail-to-top-minimum-small-spacious));
    --mod-table-thumbnail-size: var(--mod-table-thumbnail-size-spacious, var(--spectrum-thumbnail-size-300));
}

:host([density="spacious"][size="l"]) {
    --mod-table-min-row-height: var(--mod-table-min-row-height--spacious, var(--spectrum-table-row-height-large-spacious));
    --mod-table-row-top-to-text: var(--mod-table-row-top-to-text--spacious, var(--spectrum-table-row-top-to-text-large-spacious));
    --mod-table-row-bottom-to-text: var(--mod-table-row-bottom-to-text--spacious, var(--spectrum-table-row-bottom-to-text-large-spacious));
    --mod-table-row-checkbox-block-spacing: var(--mod-table-row-checkbox-block-spacing--spacious, var(--spectrum-table-row-checkbox-to-top-large-spacious));
    --mod-table-thumbnail-block-spacing: var(--mod-table-thumbnail-block-spacing-spacious, var(--spectrum-table-thumbnail-to-top-minimum-large-spacious));
    --mod-table-thumbnail-size: var(--mod-table-thumbnail-size-spacious, var(--spectrum-thumbnail-size-700));
}

:host([density="spacious"][size="xl"]) {
    --mod-table-min-row-height: var(--mod-table-min-row-height--spacious, var(--spectrum-table-row-height-extra-large-spacious));
    --mod-table-row-top-to-text: var(--mod-table-row-top-to-text--spacious, var(--spectrum-table-row-top-to-text-extra-large-spacious));
    --mod-table-row-bottom-to-text: var(--mod-table-row-bottom-to-text--spacious, var(--spectrum-table-row-bottom-to-text-extra-large-spacious));
    --mod-table-row-checkbox-block-spacing: var(--mod-table-row-checkbox-block-spacing--spacious, var(--spectrum-table-row-checkbox-to-top-extra-large-spacious));
    --mod-table-thumbnail-block-spacing: var(--mod-table-thumbnail-block-spacing-spacious, var(--spectrum-table-thumbnail-to-top-minimum-extra-large-spacious));
    --mod-table-thumbnail-size: var(--mod-table-thumbnail-size-spacious, var(--spectrum-thumbnail-size-800));
}

:host([emphasized]) {
    --spectrum-table-selected-cell-background-color: var(--highcontrast-table-selected-row-background-color, var(--mod-table-selected-row-background-color, var(--spectrum-table-selected-row-background-color)));
    --spectrum-table-selected-cell-background-color-focus: var(--highcontrast-table-selected-row-background-color-focus, var(--mod-table-selected-row-background-color-focus, var(--spectrum-table-selected-row-background-color-focus)));
}

:host([quiet]) {
    --mod-table-border-radius: var(--mod-table-border-radius--quiet, 0px);
    --mod-table-outer-border-inline-width: var(--mod-table-outer-border-inline-width--quiet, 0px);
    --mod-table-header-background-color: var(--mod-table-header-background-color--quiet, var(--spectrum-transparent-white-100));
    --mod-table-row-background-color: var(--mod-table-row-background-color--quiet, var(--spectrum-transparent-white-100));
}

:host:not(.spectrum-Table-scroller) {
    border-collapse: initial;
    border-spacing: 0;
    display: table;
}
